// utils/audio.js
const bgm = wx.getBackgroundAudioManager()

export function initAudio() {
  // 必须字段，否则 iOS 无声
  bgm.title = 'NFC 语音'
  bgm.epname = 'PageAudio'
  bgm.singer = 'NFC助手'
 
}

export function playBackground(url) {
  if (!url) return
  bgm.src = url
  bgm.play()
}

export function pauseBackground() {
  bgm.pause()
}

export function seekBackground(second) {
  bgm.seek(second)
}